' --------------------------------------------------
' 执行所有 case
' --------------------------------------------------
Private Sub test_All_Case()
    ' 基础输出测试
    test_simple_write_data 
    ' 由 DF 来执行输出
    test_simple_write_data_ByDataFrame
End Sub

' --------------------------------------------------
' 通用方法
' --------------------------------------------------
' 生成指定大小的 DataFrame
Private Function getStringDF(ByRef rsize As Long, ByRef csize As Integer) As IDataFrame
    Dim df As IDataFrame
    Dim realDF As DataFrame
    Set realDF = New DataFrame
    realDF.Init colCount:=csize, initRowSize:=rsize

    Set df = realDF
    df.appendEmptyRow rsize

    Dim ri As Long
    Dim ci As Integer
    For ri = 0 To rsize - 1
        For ci = 0 To csize - 1
            df.setDataByColIndex ri, ci, "c" & ri & ci
        Next
    Next

    Set getStringDF = df
End Function

' --------------------------------------------------
' 基础测试，输出数据
' --------------------------------------------------
' 测试直接输出字符串
Private Sub test_simple_write_data()
    ' 创建一个 20 * 20 的数据表，表内的数据为: c<行索引><列索引>
    Dim df As IDataFrame
    Set df = getStringDF(20, 20)

    Dim sh As Worksheet
    Set sh = Sheets("writeTest")

    Dim wc As DFSheetWriterContext
    Set wc = New DFSheetWriterContext

    wc.Init sh, df, sheetWriteRowNo:=10, sheetWriteColNo:=3

    wc.writeDF
End Sub

' --------------------------------------------------
' 由 DF 来执行输出
' --------------------------------------------------
Private Sub test_simple_write_data_ByDataFrame()
    ' 创建一个 20 * 20 的数据表，表内的数据为: c<行索引><列索引>
    Dim df As IDataFrame
    Set df = getStringDF(20, 20)
    
    Dim sh As Worksheet
    Set sh = Sheets("writeTest")

    df.printToWorksheet sh, sheetWriteRowNo:=9, sheetWriteColNo:=4
End Sub
